1. Field of Invention
The present invention relates generally to virtual machine technology, particularly to a method and computer for synchronous scheduling of multiple virtual CPUs (VCPUs).
2. Description of Prior Art
For most of Guest Operation Systems (GOSs), several VCPUs belonging to the same GOS do not operate synchronously in the existing virtual machine environment. Although most of operation systems and applications have little concern with whether each one of the multiple core CPUs is available simultaneously, the unsynchronized operations of several VCPUs belonging to the same GOS will lead to the following problem.
The first problem is timeout. During the operation of a GOS, Virtual Machine Monitor (VMM) transmits the clock interrupts only to the Virtual Bootstrap Processor (VBSP) of the GOS. If the scheduling of the Virtual Application Processor (VAP) in the GOS and of the VBSP in the GOS is not synchronized, the timeout problem of the timer in VAP is inevitable for the following reason. When scheduling the VAP in the GOS, which is responsible for the execution and application of the program, the VBSP in the GOS, which is responsible for the initialization of the system, has already received several interrupts transmitted by the VMM. The system time of the entire GOS has been advanced by these interrupts for a long period. Therefore, compared with the operation time of the VAP, the system time of the entire GOS has been skipped for a long period when the VAP starts up. Consequently, several timers among the time queue in the VAP are timeout. The timeout problem tends to arise particularly in the case of clock interrupt compensation mechanism.
A further problem is the performance of the concurrent execution of programs. For concurrent programs, not only the concurrent execution among multiple threads or processes, but also the synchronization with one another is required. For example, when a first thread has to wait for the result of the execution of a second thread for proceeding, it is desired that the second thread obtains its results as soon as possible. However, a plurality of threads can be executed on a plurality of different CPUs to achieve concurrent execution. If there is such a case on multiple unsynchronized VCPUs, it is likely that the untimely operation of the threads or processes on one CPU will result in the failure of threads or processes on others. It will significantly degrade the execution performance of the concurrent programs.